<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Module: StringPortuguese</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Module</strong></td>
          <td class="class-name-in-header">StringPortuguese</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../files/vendor/plugins/brazilian-rails/lib/string_portuguese_rb.html">
                vendor/plugins/brazilian-rails/lib/string_portuguese.rb
                </a>
        <br />
            </td>
        </tr>

        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000058">downcase_br</a>&nbsp;&nbsp;
      <a href="#M000055">nome_proprio</a>&nbsp;&nbsp;
      <a href="#M000056">remover_acentos</a>&nbsp;&nbsp;
      <a href="#M000057">upcase_br</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">


    <div id="constants-list">
      <h3 class="section-bar">Constants</h3>

      <div class="name-list">
        <table summary="Constants">
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">MINUSCULAS_COM_ACENTO</td>
          <td>=</td>
          <td class="context-item-value">'áéíóúâêîôûàèìòùäëïöüãõñç'</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">MAIUSCULAS_COM_ACENTO</td>
          <td>=</td>
          <td class="context-item-value">'ÁÉÍÓÚÂÊÎÔÛÀÈÌÒÙÄËÏÖÜÃÕÑÇ'</td>
        </tr>
        </table>
      </div>
    </div>



      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000058" class="method-detail">
        <a name="M000058"></a>

        <div class="method-heading">
          <a href="#M000058" class="method-signature">
          <span class="method-name">downcase_br</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Retorna uma string com caracteres minúsculos
</p>
<p>
Exemplo:
</p>
<pre>
 'TEXTO COM ACENTUAÇÃO'.downcase_br ==&gt; 'texto com acentuação'
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000058-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000058-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/string_portuguese.rb, line 43</span>
43:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">downcase_br</span>
44:     <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">tr</span>(<span class="ruby-constant">MAIUSCULAS_COM_ACENTO</span>, <span class="ruby-constant">MINUSCULAS_COM_ACENTO</span>).<span class="ruby-identifier">downcase</span>
45:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000055" class="method-detail">
        <a name="M000055"></a>

        <div class="method-heading">
          <a href="#M000055" class="method-signature">
          <span class="method-name">nome_proprio</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Normaliza nomes proprios
</p>
<p>
Exemplo:
</p>
<pre>
 'maria de souza dos santos e silva da costa'.nome_proprio ==&gt; 'Maria de Souza dos Santos e Silva da Costa'
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000055-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000055-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/string_portuguese.rb, line 9</span>
 9:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">nome_proprio</span>
10:     <span class="ruby-identifier">palavras</span> = []
11:     <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">titleize</span>().<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">palavra</span><span class="ruby-operator">|</span>
12:       <span class="ruby-identifier">palavra</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^(.)(.*)$/</span>
13:       <span class="ruby-identifier">palavras</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{$1.upcase_br}#{$2}&quot;</span>
14:     <span class="ruby-keyword kw">end</span>
15:     <span class="ruby-identifier">palavras</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">' '</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/ D(a|e|o|as|os) /</span>, <span class="ruby-value str">' d\1 '</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/ E /</span>, <span class="ruby-value str">' e '</span>)
16:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000056" class="method-detail">
        <a name="M000056"></a>

        <div class="method-heading">
          <a href="#M000056" class="method-signature">
          <span class="method-name">remover_acentos</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Remove as letras acentuadas
</p>
<p>
Exemplo:
</p>
<pre>
 'texto está com acentuação'.remover_acentos ==&gt; 'texto esta com acentuacao'
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000056-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000056-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/string_portuguese.rb, line 22</span>
22:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remover_acentos</span>
23:     <span class="ruby-identifier">texto</span> = <span class="ruby-keyword kw">self</span>
24:     <span class="ruby-identifier">texto</span> = <span class="ruby-identifier">texto</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/[á|à|ã|â|ä]/</span>, <span class="ruby-value str">'a'</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/(é|è|ê|ë)/</span>, <span class="ruby-value str">'e'</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/(í|ì|î|ï)/</span>, <span class="ruby-value str">'i'</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/(ó|ò|õ|ô|ö)/</span>, <span class="ruby-value str">'o'</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/(ú|ù|û|ü)/</span>, <span class="ruby-value str">'u'</span>)
25:     <span class="ruby-identifier">texto</span> = <span class="ruby-identifier">texto</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/(Á|À|Ã|Â|Ä)/</span>, <span class="ruby-value str">'A'</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/(É|È|Ê|Ë)/</span>, <span class="ruby-value str">'E'</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/(Í|Ì|Î|Ï)/</span>, <span class="ruby-value str">'I'</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/(Ó|Ò|Õ|Ô|Ö)/</span>, <span class="ruby-value str">'O'</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/(Ú|Ù|Û|Ü)/</span>, <span class="ruby-value str">'U'</span>)
26:     <span class="ruby-identifier">texto</span> = <span class="ruby-identifier">texto</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/ñ/</span>, <span class="ruby-value str">'n'</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/Ñ/</span>, <span class="ruby-value str">'N'</span>)
27:     <span class="ruby-identifier">texto</span> = <span class="ruby-identifier">texto</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/ç/</span>, <span class="ruby-value str">'c'</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/Ç/</span>, <span class="ruby-value str">'C'</span>)
28:     <span class="ruby-identifier">texto</span>
29:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000057" class="method-detail">
        <a name="M000057"></a>

        <div class="method-heading">
          <a href="#M000057" class="method-signature">
          <span class="method-name">upcase_br</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Retorna uma string com caracteres maiusculos
</p>
<p>
Exemplo:
</p>
<pre>
 'texto com acentuação'.upcase_br ==&gt; 'TEXTO COM ACENTUAÇÃO'
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000057-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000057-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/brazilian-rails/lib/string_portuguese.rb, line 35</span>
35:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">upcase_br</span>
36:     <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">tr</span>(<span class="ruby-constant">MINUSCULAS_COM_ACENTO</span>, <span class="ruby-constant">MAIUSCULAS_COM_ACENTO</span>).<span class="ruby-identifier">upcase</span>
37:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>